package Convertisseur;

import java.lang.reflect.Field;

public class MyTools {
	
	/** MyTools for get Name Variable
	 * @param f
	 */
	public static void setAllComponentsName(Object f){
		//
		Field[] fields  = f.getClass().getDeclaredFields();
		for(int i=0; i< fields.length; i++){
			String variableName = fields[i].getName();
			//Annotation[] annotation = fields[i].getAnnotations();
			try{
				boolean accessFlag = fields[i].isAccessible();
				fields[i].setAccessible(true);
				//get the value of field of this Object 
				Object valueField  = fields[i].get(f);
				//System.out.println("Object have this variable : "+varName+"="+o);
				System.out.println(variableName+": "+valueField);
				fields[i].setAccessible(accessFlag);
				
			}catch(IllegalArgumentException e){
				e.printStackTrace();
			}catch(IllegalAccessException e){
				e.printStackTrace();
			}
		}
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		//setAllComponentsName(new JLabel("test8"));
		setAllComponentsName(new VariableFlags());
	}

}
